package com.itdata.webservice.impl;

import java.util.List;

import javax.annotation.Resource;
import javax.jws.WebService;

import com.itdata.dao.HibernateDao;
import com.itdata.entity.UserInfo;
import com.itdata.webservice.IUserServices;

/**   
 * @Title: UserServicesImpl.java 
 * @Package com.itdata.webservice.impl 
 * @Description: TODO 
 * @author 陈凯 chenkai-ds@petrochina.com.cn   
 * @date 2013-5-14 下午9:05:04 
 * @version V1.0   
 */
@WebService
public class UserServicesImpl implements IUserServices {
	
	@Resource(name = "hibernateDao")
	public HibernateDao hibernateDao;
	
	public UserInfo getUserInfo(String userName, Integer userAge) {
		String hql = "select a from  " + UserInfo.class.getName() + " a where"
				+ " a.user_name='" + userName + "' AND a.user_password='"+userAge+"'";
	    List list=null;
		try {
			list = hibernateDao.getAll(hql);
		} catch (Exception e) {
			e.printStackTrace();
		}
		String un = "";
		Integer p = null;
		for(int i=0; i<list.size();i++){
			UserInfo u = (UserInfo) list.get(i);
			un = u.getUserName();
			p = u.getUserAge();
			System.out.println(u.getUserName());
		}
	    System.out.println("---"+userName+"=----"+userAge+list.size());
		return new UserInfo(un,p);
	}
}

